import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '保险公司',
    align: "center",
    dataIndex: 'company_dictText'
  },
  {
    title: '保险种类',
    align: "center",
    dataIndex: 'type_dictText'
  },
  {
    title: '保险产品介绍',
    align: "center",
    dataIndex: 'introduce',
    slots: { customRender: 'htmlSlot' },
  },
  {
    title: '条款信息',
    align: "center",
    dataIndex: 'terms'
  },
  {
    title: '页面编号',
    align: "center",
    dataIndex: 'serial'
  },
  {
    title: '是否启用',
    align: "center",
    dataIndex: 'state_dictText'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "保险公司",
    field: 'company',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "BXGS"
    },
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '保险公司',
    field: 'company',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "BXGS"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入保险公司!'},
             ];
    },
  },
  {
    label: '保险种类',
    field: 'type',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "BXZL"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入保险种类!'},
             ];
    },
  },
  {
    label: '保险产品介绍',
    field: 'introduce',
    component: 'JEditor',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入保险产品介绍!'},
             ];
    },
  },
  {
    label: '条款信息',
    field: 'terms',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入条款信息!'},
             ];
    },
  },
  {
    label: '页面编号',
    field: 'pageNo',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入页面编号!'},
             ];
    },
  },
  {
    label: '是否启用',
    field: 'state',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: ""
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入是否启用!'},
             ];
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
